<?php

session_start();
include_once("../class/db.php");
$db = new db();

if(!array_key_exists("user", $_SESSION) || $_SESSION['account'] != 2){
	header("Location: ../common/redirect.php");
	exit;
}
if(!array_key_exists("id", $_GET)){
	header("Location: class.php");
	exit;
}

$link = preg_replace("/[^a-zA-Z0-9_\-\.\s]/", "", $_GET['id']);
$db = new db();
$sql = "SELECT * FROM course_modules WHERE owner = {$_SESSION['user']} AND link = '$link'";
$course_modules = $db->execute($sql, "all");
if($course_modules == false){
	header("Location: class.php");
	exit;
}

$sql = "SELECT * FROM course WHERE creator = {$_SESSION['user']} AND link = '$link'";
$course = $db->execute($sql, "onerow");
if($course == false){
	header("Location: class.php");
	exit;
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PIE EDUCATION | Educational Network</title>
<link rel="stylesheet" type="text/css" href="/css/style-student.css" />
<link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet">
<script src="http://vjs.zencdn.net/c/video.js"></script>
<script type="text/javascript" src="/js/index.js"></script>
<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.7.1.custom.min.js"></script>
<script language="Javascript1.2">
<!--
setTimeout('location.href="/logout.php?expire=1"',600000);
// -->
</script>
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-35230372-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</head>

<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="#000000"><table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="350" height="30">&nbsp;</td>
        <td align="right" valign="bottom"><a href="class.php" class="top-menu" style="color:#999">MY CLASS</a> <a href="schedule.php" class="top-menu" style="color:#999">CALENDAR</a> <a href="homework.php" class="top-menu" style="color:#999">HOMEWORK</a> <a href="test.php" class="top-menu" style="color:#999">EXAMS</a> <a href="grades.php" class="top-menu" style="color:#999">GRADES</a> <a href="tools.php" class="top-menu" style="color:#999">TOOLS</a> <a href="/logout.php" class="top-menu" style="color:#999">SIGN OUT</a></td>
      </tr>
	  <tr>
        <td>&nbsp;</td>
        <td align="right" valign="bottom"><a href="/profile/" class="login-menu" style="color:#FFF"><?php echo $_SESSION['name'].' '.$_SESSION['lname']; ?></a> <a href="/common/redirect.php" class="login-menu" style="color:#FFF">My Documents</a> <a href="/network/" class="login-menu" style="color:#FFF">My Wall</a> <a href="/common/settings.php" class="login-menu" style="color:#FFF">Settings</a></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="30" style="background-image:url(/images/top-bg-student.png); background-repeat:repeat-x; background-position:top">&nbsp;</td>
  </tr>
  <tr>
    <td height="300" align="center"><table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="550" height="280" align="center"><video id="my_video_1" class="video-js vjs-default-skin" controls
  preload="auto" width="540" height="280" poster="http://video-js.zencoder.com/oceans-clip.jpg"
  data-setup="{}">
  <source src="http://video-js.zencoder.com/oceans-clip.mp4" type='video/mp4'>
  <source src="http://videojs.com/my_video.webm" type='video/webm'>
</video></td>
        <td align="center"><div id="course-title" style="font-family:Arial, Helvetica, sans-serif; font-size:36px; text-shadow:1px 1px #999; color:#000; padding-left:10px; padding-right:10px"><strong><?php echo $course['name']; ?></strong></div></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="30" align="center"><img src="../images/st.png" width="959" height="11" /></td>
  </tr>
  <tr>
  <td height="550" align="center" valign="top"><table width="980" border="0" align="center" cellpadding="4" cellspacing="4">
    <tr>
      <td width="550" valign="top">
      <div style="font-family:Arial, Helvetica, sans-serif; padding-top:5px; font-size:20px; border-bottom:thin; border-bottom-style:dashed; border-bottom-color:#ccc; height:30px">
      	What You Will Learn
      </div>
      <div style="padding-top:15px; padding-bottom:15px; font-family:Arial, Helvetica, sans-serif; color:#999; border-bottom:thin; border-bottom-style:dashed; border-bottom-color:#ccc;">
      	<?php echo $course['course_goal']; ?>
      </div>
      <?php
      foreach($course_modules as $modules){
		  echo '<div style="font-family:Arial, Helvetica, sans-serif; padding-top:15px; font-size:14px; border-bottom:thin; border-bottom-style:dashed; border-bottom-color:#ccc; height:30px;">
			<strong>'.$modules['title'].'</strong>
		  </div>';
		  $sql = "SELECT contenttype, title, id FROM course_content WHERE uid = {$modules['id']} ORDER BY order_number ASC";
		  $modules_content = $db->execute($sql, "all");
		  if($modules_content != false){
			  foreach($modules_content as $module_content){
				  switch($module_content['contenttype']){
					  case "video":
						$picture = "play_icon.png";
						break;
					  case "power_point":
						$picture = "powerpoint-icon.png";
						break;
					  case "rich-text":
						$picture = "doc_icon.png";
						break;
					  case "homework":
						$picture = "homework.png";
						break;
					  case "exam":
						$picture = "exam_icon.png";
						break;
				  }
				  echo '<div>
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
					  <tr>
						<td width="50" align="center" height="34"><img src="../images/icons/'.$picture.'" width="24" height="24" alt="'.$module_content['contenttype'].'" title="'.$module_content['contenttype'].'" /></td>
						<td style="font-family:Arial, Helvetica, sans-serif;font-size:14px;color:#999;">'.$module_content['title'].'</td>
					  </tr>
					</table>
				  </div>';
			  }
		  }
	  }
      ?>
      </td>
      <td valign="top">
      <div style="font-family:Arial, Helvetica, sans-serif; padding-left:20px; padding-top:5px; font-size:20px; border-bottom:thin; border-bottom-style:dashed; border-bottom-color:#ccc; height:30px;width:420px">Meet Your Teacher <?php echo $_SESSION['name']." ".$_SESSION['lname']; ?></div>
      <div style="padding-left:20px; color:#999">
      	<img src="/images/profile/<?php echo $_SESSION['user']; ?>.jpg" class="floatLeft" width="120px" height="120px" alt="<?php echo $_SESSION['name']." ".$_SESSION['lname']; ?>" title="<?php echo $_SESSION['name']." ".$_SESSION['lname']; ?>">
		<p>"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"</p>
		<ul>
		  <li>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium</li>
		  <li>Sed ut perspiciatis unde omnis iste natus error</li>
		  <li>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ips</li>
		  </ul>
		<p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsaSed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsaSed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsaSed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsaSed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsaSed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsaSed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsaSed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa</p>
      </div>
      </td>
    </tr>
  </table></td>
  </tr>
  <tr>
    <td height="30" align="center" style=" background-image:url(../images/bottom-bg-student.png); background-repeat:repeat-x;">&nbsp;</td>
  </tr>
  <tr>
    <td height="50"align="center" bgcolor="#000000" style="color:#fff; font-family:Arial, Helvetica, sans-serif">PIE.EDU All Rights Reserved 2012<br />
      <a href="/common/privacy.php" class="bottom-menu" style="color:#999">Privacy Policy</a> | <a href="/common/terms.php" class="bottom-menu"  style="color:#999">Terms of Use</a> | <a href="/help/main.php" class="bottom-menu" style="color:#999">Help Center</a> | <a href="/common/jobs.php" class="bottom-menu" style="color:#999">Jobs</a></td>
  </tr>
</table>
</body>
</html>